package com.gitee.wsl.mathematics.matrix.mat2.ext

import com.gitee.wsl.mathematics.matrix.mat2.Matrix2
import com.gitee.wsl.mathematics.matrix.mat2.MutableMatrix2
import com.gitee.wsl.mathematics.matrix.mat3.Matrix3
import com.gitee.wsl.mathematics.matrix.mat3.MutableMatrix3
import com.gitee.wsl.mathematics.vector.vec2.Vector2


val <T:Number> Matrix2<T, *, *>.scale get() = createVec2(sqrt(m00 * m00 + m01 * m01),sqrt(m10 * m10 + m11 * m11))

fun<T:Number> MutableMatrix2<T, *, *>.scale(sx: T, sy: T){
    n[0]*=sx
    n[1]*=sy
}

fun<T:Number> MutableMatrix2<T, *, *>.scale(scale: Vector2<T, *>) = scale(scale.x, scale.y)
